import http from "./request";
import {IBookListData} from "./type"

// 分页获取书籍列表
export const getBookList = (params:IBookListData)=>{
    return http({
        url:"/api/book",
        method:'get',
        params
    })
}

// 根据id查找书籍
export const getBookById = (id:string)=>{
    return http({
        url:`/api/book/${id}`,
        method:"get",
    })
}

// 修改书籍（浏览数和评论数）
export const updateBookInfo = (id:string,bookTitle:string)=>{
    return http({
        url:`/api/book/${id}`,
        method:"patch",
        data:{
            bookTitle
        }
    })
}